package com.foton.ai.service.factory;


import com.foton.ai.service.TongYiService;
import com.foton.ai.service.impl.TongYiAudioSimpleServiceImpl;
import com.foton.ai.service.impl.TongYiImageServiceImpl;
import com.foton.ai.service.impl.TongYiSimpleServiceImpl;
import com.foton.ai.uils.Constants;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 策略工厂类实现
 */

@Configuration
public class TongYiStrategyFactory {


    @Bean("idGeneratorMap")
    public Map<Integer, TongYiService> getIdGenerator(TongYiSimpleServiceImpl tongYiSimpleServiceImpl, TongYiImageServiceImpl tongYiImageServiceImpl, TongYiAudioSimpleServiceImpl tongYiAudioSimpleServiceImpl) {
        Map<Integer, TongYiService> idsIdGeneratorMap = new ConcurrentHashMap<>(8);
        idsIdGeneratorMap.put(Constants.TongYiIds.SIMPLE.getCode(), tongYiSimpleServiceImpl);
        idsIdGeneratorMap.put(Constants.TongYiIds.IMAGE.getCode(), tongYiImageServiceImpl);
        idsIdGeneratorMap.put(Constants.TongYiIds.AUDIO.getCode(), tongYiAudioSimpleServiceImpl);
        return idsIdGeneratorMap;
    }


}
